import request from '@/utils/request'

export function getGoods(msg) {
	let query = new FormData();
	query.append('pageNum', msg.pageNum);
	query.append('pageSize', msg.pageSize);
	if(msg.pmsBrandName != undefined){
		query.append('pmsBrandName', msg.pmsBrandName);
	}
	if(msg.name != undefined){
		query.append('name', msg.name);
	}
    return request({
		headers: {
			"Content-Type": "multipart/form-data"
		},
        url: "/api/goods/list",
        method: "POST",
        data: query
    })
}

export function getGoodsInfo(id) {
    return request({
        url: `/api/goods/get/${id}`,
        method: "GET"
    })
}

export function getGoodsBarCode(id) {
    return request({
        url: `/api/goods/get/${id}`,
        method: "GET"
    })
}

export function deleteManyGoods(query) {
    return request({
        url: `/api/goods/deleteIds`,
        method: "DElETE",
        data: query
    })
}

export function deleteGoods(id) {
    return request({
        url: `/api/goods/delete/${id}`,
        method: "DElETE"
    })
}

export function createGoods(query) {
    return request({
        url: `/api/goods/create`,
        method: "POST",
        data: query
    })
}

export function updateGoods(query) {
    return request({
        url: `/api/goods/update`,
        method: "PUT",
        data: query
    })
}